/**
 * Created with IntelliJ IDEA.
 * User: ajhin
 * Date: 4/1/14
 * Time: 7:39 PM
 * To change this template use File | Settings | File Templates.
 */
package com.societyGames.codeAlong.state.codeExercise.view.actions
{
import com.pblabs.engine.serialization.Serializer;
import com.societyGames.action.IAction;
import com.societyGames.codeAlong.state.codeExercise.view.EditorView;

import flash.utils.getDefinitionByName;

public class ActionFactory
{
  private var highlightAction:HighlightAction; //Keeps it from compiling out.

  public static function create(xml:XML, editorView:EditorView):IAction
  {
    var className:String = "com.societyGames.codeAlong.state.codeExercise.view.actions." + xml.@type;
    var actionClass:Class = Class(getDefinitionByName(className));
    var action:IAction = IAction(new actionClass(editorView));
    Serializer.instance.deserialize(action, xml);
    return action;
  }
}
}
